<!doctype html>
<html lang="en-US">
  <head>
    <link href="/assets/index.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <main id="webchat"></main>
    <script type="importmap">
      {
        "imports": {
          "botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js",
          "jest-mock": "https://esm.sh/jest-mock",
          "react": "/__dist__/packages/bundle/static/react.js",
          "react-dom": "/__dist__/packages/bundle/static/react-dom.js"
        }
      }
    </script>
    <script type="module">
      import { fn, spyOn } from 'jest-mock';

      spyOn(console, 'warn');
    </script>
    <script type="module">
      import '/test-harness.mjs';
      import '/test-page-object.mjs';

      import { createDirectLine, createStoreWithOptions, hooks, renderWebChat } from 'botframework-webchat';
      import { version } from 'react';

      run(async function () {
        expect(console.warn).toHaveBeenCalledTimes(0);

        // WHEN: Touching "hooks.useStyleOptions".
        expect(hooks.useStyleOptions).not.toBeUndefined();

        // THEN: Should show deprecation note.
        expect(console.warn).toHaveBeenCalledTimes(1);
        expect(console.warn).toHaveBeenLastCalledWith(
          "botframework-webchat: `import { hooks } from 'botframework-webchat'` has been deprecated, use `import { %s } from 'botframework-webchat/hook'` instead.",
          'useStyleOptions'
        );

        // WHEN: Touching "hooks.useStyleSet".
        expect(hooks.useStyleSet).not.toBeUndefined();

        // THEN: Should not show deprecation note again.
        expect(console.warn).toHaveBeenCalledTimes(1);
      });
    </script>
  </body>
</html>
